#include"common.h"

// if condition is false,exit!
void myAssert(bool condition, const char *errmsg)
{
    if (!condition)
    {
        perror(errmsg);
        exit(EXIT_FAILURE);
    }
}

// 设置非阻塞模式
void setnonblocking(int fd)
{
    int flag = fcntl(fd, F_GETFL, 0);
    flag |= O_NONBLOCK;
    fcntl(fd, F_SETFL, flag);
}



